<!-- 通告 -->
<template>
    <div class="noticeC">
        <!-- 这里改为日期计算器 -->
        <dateComputed/>
    </div>
</template>

<style scoped>
.noticeC {
    display: flex;
    /* background-color: #409EFF; */
    background-color: #4479d4;
    border-radius: 5px;
}
</style>

<script>
// 引入时间计算器
import dateComputed from "./dateComputed"
export default {
    data(){
        return {
        }
    },
    components:{
        dateComputed
    },
    created(){
        
        new Promise((res,rej)=>{
            // 发送请求信息，获取地理位置
            this.$api.axios("https://restapi.amap.com/v3/ip?key=4c75405d2e43b5a46a4ccd6c28dc57c1").then(data=>{
                if(data.data.status){
                    this.city=data.data.city;
                    res()
                }
            })
        }).then(()=>{
            console.log('this.city',this.city)
            this.$api.axios("http://wthrcdn.etouch.cn/weather_mini?city="+this.city).then((date)=>{
                // this.weatherDate=date.data.data;
                this.wendu=date.data.data.wendu;
                this.city=date.data.data.city;
                this.todayDate=date.data.data.forecast.splice(0,1)[0];
                this.weatherDate=date.data.data.forecast;
                console.log('天气数据',this.weatherDate)
            })
        }).catch(err=>{console.log(err)});
        
    }
}
</script>